package com.mcp.converter.domain.rule.compatibility;

import com.mcp.converter.shared.enums.IncompatibilityType;
import com.mcp.converter.domain.checker.IncompatibilityDetail;

/**
 * SQL语法兼容性规则抽象类
 * 用于检测Oracle SQL语法与OceanBase的兼容性
 * @author zengxiong
 */
public abstract class AbstractSyntaxRule implements CompatibilityRule {
    
    private String id;
    private String name;
    private String description;
    private IncompatibilityDetail incompatibilityDetail;
    
    public AbstractSyntaxRule(String id, String name, String description) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.incompatibilityDetail = new IncompatibilityDetail();
    }
    
    @Override
    public String getId() {
        return id;
    }
    
    @Override
    public String getName() {
        return name;
    }
    
    @Override
    public String getDescription() {
        return description;
    }
    
    @Override
    public IncompatibilityType getIncompatibilityType() {
        return IncompatibilityType.SYNTAX;
    }
    
    @Override
    public IncompatibilityDetail getIncompatibilityDetail() {
        return incompatibilityDetail;
    }
    
    /**
     * 设置不兼容详情
     * @param reason 不兼容原因
     * @param impact 不兼容影响
     * @param suggestion 转换建议
     * @param severity 严重程度
     */
    protected void setIncompatibilityDetail(String reason, String impact, String suggestion, IncompatibilityDetail.Severity severity) {
        this.incompatibilityDetail.setReason(reason);
        this.incompatibilityDetail.setImpact(impact);
        this.incompatibilityDetail.setSuggestion(suggestion);
        this.incompatibilityDetail.setSeverity(severity);
    }
}
